using Castle.MonoRail.Framework;

namespace AndyPike.Snowflake.Web.Filters
{
    public class AuthenticationFilter : IFilter
    {
        public bool Perform(ExecuteWhen exec, IEngineContext context, IController controller, IControllerContext controllerContext)
        {
            if(context.CurrentUser == null)
            {
                context.Response.Redirect("Home", "Index");
                return false;
            }

            return true;
        }
    }
}